<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<title>用户住粗列表</title>

<h1>用户注册列表</h1><br>
<form action="<%=request.getContextPath()%>/register" method="post" style="text-align: center">
<%--<form method="post">--%>
    请输入账号<input type="text" name="username" id="username"><br>
    请输入密码<input type="password" name="password" id="password"><br>
    请输入网名<input type="text" name="netName"><br>

    <input type="radio" name="sex" value="male" checked="checked">先生
    <input type="radio" name="sex" value="female">女士
    <input type="submit" value="提交数据" onclick="return judgment()">
</form>
<script type="text/javascript">
    const reg1 = /^[0-9]{6,16}$/;
    const reg2 = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,20}$/;

    function judgment(){
        let username = document.getElementById("username").value;
        let password = document.getElementById("password").value;
        if(!reg1.test(username)){
            alert("账号格式为6-16个整数");
            return false;
        }
        if(!reg2.test(password)){
            alert("密码包含数字，英文，字符中的两种以上，长度为6-20");
            return false;
        }
        return true;
    }

</script>
<style>
    body{
        background-image: url("picture/new.jpg");
        background-repeat: no-repeat;
        background-attachment: fixed;
        background-position: center center;
        background-size: 100% 100%;
    }
</style>
<a href="<%=request.getContextPath()%>/index.jsp">返回登录</a>